import { PrimaryLoadingComponent } from '@/conponents/loading'
import { h, render } from 'vue'

export function useNodeUtil() {
  /**
   * 在body上添加全局的Loading
   */
  const loadingStart = () => {
    const ncp = document.querySelector('#ncp')
    render(h(PrimaryLoadingComponent), ncp as HTMLElement)
  }
  /**
   * 停止
   */
  const loadingStop = () => {
    const ncp = document.querySelector('#ncp')
    render(null, ncp as HTMLElement)
  }

  return {
    loadingStart,
    loadingStop
  }
}
